import React, { lazy } from 'react'
import { RouterArr } from '../index'
import LayoutIndex from '@/layouts/index'

const Goods = lazy(() => import('@/pages/Goods/index'))
const GoodsAddOrEdit = lazy(() => import('@/pages/Goods/addOrEdit'))

const goodsRouter: Array<RouterArr> = [
  {
    element: <LayoutIndex />,
    children: [
      {
        path: '/goods',
        element: <Goods />,
        meta: {
          requiresAuth: true,
          title: '商品列表',
          key: 'goods'
        }
      },
      {
        path: '/goods_add',
        element: <GoodsAddOrEdit />,
        meta: {
          requiresAuth: true,
          title: '商品添加',
          key: 'goods_add'
        },
        isLink: false
      },
      {
        path: '/goods_edit',
        element: <GoodsAddOrEdit />,
        meta: {
          requiresAuth: true,
          title: '商品编辑',
          key: 'goods_edit'
        },
        isLink: false
      }
    ]
  }
]

export default goodsRouter
